package com.little.pattern.stratety;

import com.little.pattern.stratety.behavior.FlyBehavior;
import com.little.pattern.stratety.behavior.QuackBehavior;

/**
 * 鸭子基类
 * Created by littleshu on 18/5/1.
 */
public class Duck {

    //飞行行为
    protected FlyBehavior flyBehavior;
    //叫行为
    protected QuackBehavior quackBehavior;


    public void display() {
        System.out.println("鸭子");
    }

    public void fly(){
        flyBehavior.fly();
    }

    public void quack(){
        quackBehavior.quack();
    }

    public void setFlyBehavior(FlyBehavior flyBehavior) {
        this.flyBehavior = flyBehavior;
    }

    public void setQuackBehavior(QuackBehavior quackBehavior) {
        this.quackBehavior = quackBehavior;
    }
}
